using MediatR;
using RBAC.ErrorCode;
using System.Collections.Generic;

namespace RBAC.Write.Api.Application.Command.ProcessManagements
{
    /// <summary>
    /// 新增工艺流程（主信息 + 明细 + 附件）
    /// </summary>
    public class AddProcessFlowCommand : IRequest<APIResult<int>>
    {
        /// <summary>
        /// 工艺流程编号（如：CF-001）。必填且唯一
        /// </summary>
        public string? FlowCode { get; set; }

        /// <summary>
        /// 系统编号（页面显示编号，可选）
        /// </summary>
        public string? SystemCode { get; set; }

        /// <summary>
        /// 工艺流程名称。必填且唯一
        /// </summary>
        public string? FlowName { get; set; }

        /// <summary>
        /// 负责人用户Id
        /// </summary>
        public long? OwnerUserId { get; set; }

        /// <summary>
        /// 负责人用户名（当前前端只填写名称）
        /// </summary>
        public string? OwnerUserName { get; set; }

        /// <summary>
        /// 所属部门Id
        /// </summary>
        public long? DepartmentId { get; set; }

        /// <summary>
        /// 所属部门名称
        /// </summary>
        public string? DepartmentName { get; set; }

        /// <summary>
        /// 状态（1=启用，0=禁用）
        /// </summary>
        public int Status { get; set; } = 1;

        /// <summary>
        /// 备注
        /// </summary>
        public string? Remark { get; set; }

        /// <summary>
        /// 明细工序集合
        /// </summary>
        public List<ProcessFlowDetailInput>? Details { get; set; }

        /// <summary>
        /// 附件集合
        /// </summary>
        public List<ProcessFlowAttachmentInput>? Attachments { get; set; }
    }

    /// <summary>
    /// 工艺流程-明细输入
    /// </summary>
    public class ProcessFlowDetailInput
    {
        /// <summary>
        /// 排序
        /// </summary>
        public int Sort { get; set; }
        /// <summary>
        /// 工序Id
        /// </summary>
        public long ProcessId { get; set; }
        /// <summary>
        /// 工序编号
        /// </summary>
        public string? ProcessCode { get; set; }
        /// <summary>
        /// 工序名称
        /// </summary>
        public string? ProcessName { get; set; }
        /// <summary>
        /// 负责人用户Id
        /// </summary>
        public long? OwnerUserId { get; set; }
        /// <summary>
        /// 负责人用户名
        /// </summary>
        public string? OwnerUserName { get; set; }
        /// <summary>
        /// 所属部门Id
        /// </summary>
        public long? DepartmentId { get; set; }
        /// <summary>
        /// 所属部门名称
        /// </summary>
        public string? DepartmentName { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string? Remark { get; set; }
    }

    /// <summary>
    /// 工艺流程-附件输入
    /// </summary>
    public class ProcessFlowAttachmentInput
    {

        /// <summary>
        /// 文件名
        /// </summary>
        public string? FileName { get; set; } 
        /// <summary>
        /// 文件路径
        /// </summary>
        public string? FileUrl { get; set; }
        /// <summary>
        /// 文件大小
        /// </summary>
        public long? FileSize { get; set; }
        /// <summary>
        /// 文件类型
        /// </summary>
        public string? ContentType { get; set; }
        /// <summary>
        /// 文件Hash
        /// </summary>
        public string? FileHash { get; set; }
        /// <summary>
        /// 状态
        /// </summary>
        public int Status { get; set; } = 1;
        /// <summary>
        /// 备注
        /// </summary>
        public string? Remark { get; set; }
    }
}
